package com.xjh.mange.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 徐佳辉
 * @date 2020/12/22 16:57
 */
@Configuration
public class UpConfig implements WebMvcConfigurer {

    @Value("${picture.url}")
    private String picPath;
    @Value("${web.url}")
    private String webPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 物品图片
        registry.addResourceHandler("/pic/**").addResourceLocations("file:" + picPath);
        // 网站图片
        registry.addResourceHandler("/web/**").addResourceLocations("file:" + webPath);
    }
}
